-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Add setProviderAndWait method for blocking provider initialization #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add setProviderAndWait method for blocking provider initialization #200
Conversation
This implements the OpenFeature specification requirement for setProviderAndWait, providing a blocking method to register providers and wait for initialization. Changes: - Add ProviderInitializationError exception class with provider and original_error context - Implement set_provider_and_wait method in Configuration class with timeout support - Add delegation in API class to expose set_provider_and_wait method - Provide SDK-level access through method_missing delegation - Add comprehensive test coverage for all scenarios including timeouts, failures, and concurrency - Update README.md with usage examples and documentation The method ensures provider readiness before returning and handles initialization failures gracefully with detailed error information. Signed-off-by: Leo Romanovsky <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #200 +/- ##
==========================================
+ Coverage 99.57% 99.61% +0.04%
==========================================
Files 16 17 +1
Lines 233 259 +26
==========================================
+ Hits 232 258 +26
Misses 1 1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
beeme1mr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a decent amount of thrash in this PR due to some style change " vs '. I'm not a Ruby expect but it does appear that the change matches the Ruby style guide. If that's the preferred approach, would you mind making that change in a sperate PR?
beeme1mr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems @josecolella agrees that we should move the refactor to a separate PR. Update my review so the change doesn't accidently get merged.
- Convert single quotes to double quotes per project style guide - Remove explicit StandardError class from rescue clauses - Align string literal formatting with CI expectations Signed-off-by: Leo Romanovsky <[email protected]>
Sorry about the lint (quotation changes); my local ruby environment had some differences from CI. I got them synchronized now and the diff is just focused on functionality. Thanks for the reviews! |
beeme1mr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good from an OpenFeature perspective aside from the missing error code. @josecolella do you have any other concerns?
Looks fine to me |
Per reviewer feedback, add OpenFeature error code support to the ProviderInitializationError exception class: - Add error_code attribute with PROVIDER_FATAL default per OpenFeature spec - Support custom error codes via constructor parameter - Update all tests to verify error_code is properly set - Update documentation to show error_code usage in exception handling Addresses PR feedback from @beeme1mr regarding OpenFeature specification requirement for provider initialization error codes. Signed-off-by: Leo Romanovsky <[email protected]>
This implements the OpenFeature specification requirement for setProviderAndWait, providing a blocking method to register providers and wait for initialization.
Changes:
The method ensures provider readiness before returning and handles initialization failures gracefully with detailed error information.
This PR
Related Issues
Solves OpenFeature Specification Requirement 1.1.2.4:
https://openfeature.dev/specification/sections/flag-evaluation/#requirement-1124
Notes
Follow-up Tasks
How to test